# -*- encoding: utf-8 -*-
"""

PyCharm 11bar函数绘制柱状图
2024年10月27日12时49分
by wenyang

文件主要内容:


"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt



def main():
    # 下面两个句子就是为了解决中文系那是问题 以及负号显示问题
    mpl.rcParams["font.sans-serif"] = ["SimHei"]
    mpl.rcParams["axes.unicode_minus"] = False
    x = np.arange(1, 9)
    y = np.random.randint(1, 10, 8)
    plt.xlim(1, 8)
    plt.ylim(1, 10)
    plt.xlabel("Time(s)")
    plt.ylabel("Amplitude")
    plt.title("柱状图展示")
    plt.bar(x, y, color = "r", alpha = 0.5, label = "柱状图展示", tick_label = ["A", "B", "C", "D", "E", "F", "G", "H"])
    plt.legend(loc = "best")
    plt.show()



if __name__ == "__main__":
    main()
